<template>
  <div class="app-container">
    <el-form class="my-form" ref="obj" label-position="right" disabled label-width="96px">
      <el-form-item label="通知类型" prop="noticeType">
        <DictTag :dict-list="getDictList('BudgetNoticeType')" :dict-key="obj.publishState"/>
      </el-form-item>
      <el-form-item label="通知标题" prop="noticeTitle">
        {{obj.noticeTitle}}
      </el-form-item>
      <el-form-item label="通知内容" prop="noticeContent">
        <span v-html="obj.noticeContent"></span>
      </el-form-item>
      <el-form-item label="预算年度" prop="budgetYear">
        {{obj.budgetYear}}
      </el-form-item>
      <!--
      <el-form-item label="编报类型" prop="applyType">
        {{obj.applyType}}
      </el-form-item>
      -->
      <el-form-item label="截止日期" prop="expireDate">
        {{obj.expireDate?.substring(0,10)}}
      </el-form-item>
      <el-form-item label="发布状态" prop="publishState">
        <EnumTag :enum-list="getEnumList('PublishState')" :enum-key="obj.publishState" />
      </el-form-item>
      <el-form-item label="附件" prop="attachment1Id">
         <FileUpload :isDrag="true" v-model="fileData" v-model:isReadonly="fileuploadReadonly"></FileUpload>
      </el-form-item>
      <el-form-item label="创建时间">
        {{obj.createTime}}
      </el-form-item>
      <el-form-item label="最后修改时间">
        {{obj.updateTime}}
      </el-form-item>
    </el-form>
  </div>
</template>
<script setup>
import {ref, watch} from 'vue'
import {doGet} from "@/config/http";
import {svc, getEnumList, getDictList} from "@/config/common";

let obj = ref({})
// 一上通知
const props = defineProps({
  projectNoticeId: {
    required: true,
    type: String,
  },
})

const fileuploadReadonly = ref(true)
const fileData = ref([])

const getData = async id => {
  // 这里调用接口
  obj.value = await doGet(svc, `/budget-project-notice/${id}`, {}, true)
  fileData.value = await doGet(svc, '/budget-project-notice-file/listByField', {field: 'budgetProjectNoticeId', values: id}, false)
}

watch(() => props.projectNoticeId, async val => {
  await getData(val)
},{immediate:true})
</script>
